package com.newstart.controller;

import com.newstart.bean.User;
import com.newstart.service.StartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by liushijie on 2018/5/28.
 */
@RestController
public class StartController {
    @Autowired
    private StartService startService;

    @RequestMapping(value = "user/{id}", method = RequestMethod.GET)
    public User getUser(@PathVariable Long id) {

        User u = startService.getUser(id);
        return u;
    }

    @RequestMapping(value = "session", method = RequestMethod.GET)
    public String getSession(HttpServletRequest req) {
        return startService.getSession();
    }

    @RequestMapping(value = "session", method = RequestMethod.PUT)
    public void setSession(HttpServletRequest req) {
        startService.setSession();
    }

}
